package com.brokendust.client.api.util.image;

import com.brokendust.client.manager.ClientManager;
import net.minecraft.util.ResourceLocation;

public class ImageControl {
    public static ResourceLocation getResourceLocation(String path) {
        ImageInfo imageInfo;
        if (ClientManager.imageInfoMap.containsKey(path)) {
            imageInfo = ClientManager.imageInfoMap.get(path);
        } else {
            imageInfo = new ImageInfo(path);
            ClientManager.imageInfoMap.put(path, imageInfo);
        }
        return imageInfo.getResourceLocation();
    }

    public static int getWidth(String path) {
        ImageInfo imageInfo;
        if (ClientManager.imageInfoMap.containsKey(path)) {
            imageInfo = ClientManager.imageInfoMap.get(path);
        } else {
            imageInfo = new ImageInfo(path);
            ClientManager.imageInfoMap.put(path, imageInfo);
        }
        return imageInfo.getWidth();
    }

    public static int getHeight(String path) {
        ImageInfo imageInfo;
        if (ClientManager.imageInfoMap.containsKey(path)) {
            imageInfo = ClientManager.imageInfoMap.get(path);
        } else {
            imageInfo = new ImageInfo(path);
            ClientManager.imageInfoMap.put(path, imageInfo);
        }
        return imageInfo.getHeight();
    }
}

